package org.aspectsense.dsl;

// $ANTLR 3.2 Sep 23, 2009 12:02:23 C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g 2009-11-23 17:46:01

import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

public class utilityParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "PLUS", "MINUS", "MULT", "DIV", "GT", "LT", "GTE", "LTE", "EQ", "NEQ", "FLOAT", "INT", "ID", "EXPONENT", "WS", "'?'", "':'", "'('", "')'"
    };
    public static final int EXPONENT=17;
    public static final int LT=9;
    public static final int T__22=22;
    public static final int T__21=21;
    public static final int T__20=20;
    public static final int GTE=10;
    public static final int FLOAT=14;
    public static final int INT=15;
    public static final int MINUS=5;
    public static final int MULT=6;
    public static final int ID=16;
    public static final int EOF=-1;
    public static final int LTE=11;
    public static final int T__19=19;
    public static final int WS=18;
    public static final int NEQ=13;
    public static final int GT=8;
    public static final int PLUS=4;
    public static final int DIV=7;
    public static final int EQ=12;

    // delegates
    // delegators


        public utilityParser(TokenStream input) {
            this(input, new RecognizerSharedState());
        }
        public utilityParser(TokenStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        

    public String[] getTokenNames() { return utilityParser.tokenNames; }
    public String getGrammarFileName() { return "C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g"; }



    // $ANTLR start "prog"
    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:19:1: prog : ( stat )+ ;
    public final void prog() throws RecognitionException {
        try {
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:19:11: ( ( stat )+ )
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:19:13: ( stat )+
            {
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:19:13: ( stat )+
            int cnt1=0;
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( ((LA1_0>=FLOAT && LA1_0<=INT)||LA1_0==21) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:19:13: stat
            	    {
            	    pushFollow(FOLLOW_stat_in_prog113);
            	    stat();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt1 >= 1 ) break loop1;
                        EarlyExitException eee =
                            new EarlyExitException(1, input);
                        throw eee;
                }
                cnt1++;
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "prog"


    // $ANTLR start "stat"
    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:22:1: stat : expr ;
    public final void stat() throws RecognitionException {
        double expr1 = 0.0;


        try {
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:22:12: ( expr )
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:22:14: expr
            {
            pushFollow(FOLLOW_expr_in_stat135);
            expr1=expr();

            state._fsp--;

            System.out.println(expr1);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "stat"


    // $ANTLR start "expr"
    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:25:1: expr returns [double value] : e= term (t= ternary[$e.value] )? ;
    public final double expr() throws RecognitionException {
        double value = 0.0;

        double e = 0.0;

        double t = 0.0;


        try {
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:25:30: (e= term (t= ternary[$e.value] )? )
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:25:32: e= term (t= ternary[$e.value] )?
            {
            pushFollow(FOLLOW_term_in_expr159);
            e=term();

            state._fsp--;

            value = e;
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:25:60: (t= ternary[$e.value] )?
            int alt2=2;
            int LA2_0 = input.LA(1);

            if ( ((LA2_0>=GT && LA2_0<=NEQ)) ) {
                alt2=1;
            }
            switch (alt2) {
                case 1 :
                    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:25:61: t= ternary[$e.value]
                    {
                    pushFollow(FOLLOW_ternary_in_expr166);
                    t=ternary(e);

                    state._fsp--;

                    value = t;

                    }
                    break;

            }


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return value;
    }
    // $ANTLR end "expr"


    // $ANTLR start "ternary"
    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:28:1: ternary[double arg] returns [double value] : e= condition[$arg] '?' a= term ':' b= term ;
    public final double ternary(double arg) throws RecognitionException {
        double value = 0.0;

        boolean e = false;

        double a = 0.0;

        double b = 0.0;


        try {
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:28:45: (e= condition[$arg] '?' a= term ':' b= term )
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:28:47: e= condition[$arg] '?' a= term ':' b= term
            {
            pushFollow(FOLLOW_condition_in_ternary194);
            e=condition(arg);

            state._fsp--;

            match(input,19,FOLLOW_19_in_ternary197); 
            pushFollow(FOLLOW_term_in_ternary201);
            a=term();

            state._fsp--;

            match(input,20,FOLLOW_20_in_ternary203); 
            pushFollow(FOLLOW_term_in_ternary207);
            b=term();

            state._fsp--;

            if (e) {value =a;} else {value =b;}

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return value;
    }
    // $ANTLR end "ternary"


    // $ANTLR start "condition"
    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:31:1: condition[double arg] returns [boolean value] : ( GT b= term | LT b= term | GTE b= term | LTE b= term | EQ b= term | NEQ b= term );
    public final boolean condition(double arg) throws RecognitionException {
        boolean value = false;

        double b = 0.0;


        try {
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:31:48: ( GT b= term | LT b= term | GTE b= term | LTE b= term | EQ b= term | NEQ b= term )
            int alt3=6;
            switch ( input.LA(1) ) {
            case GT:
                {
                alt3=1;
                }
                break;
            case LT:
                {
                alt3=2;
                }
                break;
            case GTE:
                {
                alt3=3;
                }
                break;
            case LTE:
                {
                alt3=4;
                }
                break;
            case EQ:
                {
                alt3=5;
                }
                break;
            case NEQ:
                {
                alt3=6;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 3, 0, input);

                throw nvae;
            }

            switch (alt3) {
                case 1 :
                    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:31:50: GT b= term
                    {
                    match(input,GT,FOLLOW_GT_in_condition235); 
                    pushFollow(FOLLOW_term_in_condition239);
                    b=term();

                    state._fsp--;

                    value = arg > b;

                    }
                    break;
                case 2 :
                    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:32:9: LT b= term
                    {
                    match(input,LT,FOLLOW_LT_in_condition252); 
                    pushFollow(FOLLOW_term_in_condition256);
                    b=term();

                    state._fsp--;

                    value = arg < b;

                    }
                    break;
                case 3 :
                    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:33:9: GTE b= term
                    {
                    match(input,GTE,FOLLOW_GTE_in_condition269); 
                    pushFollow(FOLLOW_term_in_condition273);
                    b=term();

                    state._fsp--;

                    value = arg >= b;

                    }
                    break;
                case 4 :
                    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:34:9: LTE b= term
                    {
                    match(input,LTE,FOLLOW_LTE_in_condition285); 
                    pushFollow(FOLLOW_term_in_condition289);
                    b=term();

                    state._fsp--;

                    value = arg <= b;

                    }
                    break;
                case 5 :
                    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:35:9: EQ b= term
                    {
                    match(input,EQ,FOLLOW_EQ_in_condition301); 
                    pushFollow(FOLLOW_term_in_condition305);
                    b=term();

                    state._fsp--;

                    value = arg == b;

                    }
                    break;
                case 6 :
                    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:36:9: NEQ b= term
                    {
                    match(input,NEQ,FOLLOW_NEQ_in_condition317); 
                    pushFollow(FOLLOW_term_in_condition321);
                    b=term();

                    state._fsp--;

                    value = arg != b;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return value;
    }
    // $ANTLR end "condition"


    // $ANTLR start "term"
    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:39:1: term returns [double value] : e= mord ( PLUS e= mord | MINUS e= mord )* ;
    public final double term() throws RecognitionException {
        double value = 0.0;

        double e = 0.0;


        try {
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:39:31: (e= mord ( PLUS e= mord | MINUS e= mord )* )
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:39:33: e= mord ( PLUS e= mord | MINUS e= mord )*
            {
            pushFollow(FOLLOW_mord_in_term351);
            e=mord();

            state._fsp--;

            value = e;
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:39:60: ( PLUS e= mord | MINUS e= mord )*
            loop4:
            do {
                int alt4=3;
                int LA4_0 = input.LA(1);

                if ( (LA4_0==PLUS) ) {
                    alt4=1;
                }
                else if ( (LA4_0==MINUS) ) {
                    alt4=2;
                }


                switch (alt4) {
            	case 1 :
            	    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:39:62: PLUS e= mord
            	    {
            	    match(input,PLUS,FOLLOW_PLUS_in_term356); 
            	    pushFollow(FOLLOW_mord_in_term360);
            	    e=mord();

            	    state._fsp--;

            	    value += e;

            	    }
            	    break;
            	case 2 :
            	    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:40:15: MINUS e= mord
            	    {
            	    match(input,MINUS,FOLLOW_MINUS_in_term379); 
            	    pushFollow(FOLLOW_mord_in_term383);
            	    e=mord();

            	    state._fsp--;

            	    value -= e;

            	    }
            	    break;

            	default :
            	    break loop4;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return value;
    }
    // $ANTLR end "term"


    // $ANTLR start "mord"
    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:44:1: mord returns [double value] : e= factor ( MULT e= factor | DIV e= factor )* ;
    public final double mord() throws RecognitionException {
        double value = 0.0;

        double e = 0.0;


        try {
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:44:31: (e= factor ( MULT e= factor | DIV e= factor )* )
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:44:33: e= factor ( MULT e= factor | DIV e= factor )*
            {
            pushFollow(FOLLOW_factor_in_mord425);
            e=factor();

            state._fsp--;

            value = e;
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:44:63: ( MULT e= factor | DIV e= factor )*
            loop5:
            do {
                int alt5=3;
                int LA5_0 = input.LA(1);

                if ( (LA5_0==MULT) ) {
                    alt5=1;
                }
                else if ( (LA5_0==DIV) ) {
                    alt5=2;
                }


                switch (alt5) {
            	case 1 :
            	    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:44:65: MULT e= factor
            	    {
            	    match(input,MULT,FOLLOW_MULT_in_mord431); 
            	    pushFollow(FOLLOW_factor_in_mord435);
            	    e=factor();

            	    state._fsp--;

            	    value *= e;

            	    }
            	    break;
            	case 2 :
            	    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:45:13: DIV e= factor
            	    {
            	    match(input,DIV,FOLLOW_DIV_in_mord452); 
            	    pushFollow(FOLLOW_factor_in_mord456);
            	    e=factor();

            	    state._fsp--;

            	     value /= e ;

            	    }
            	    break;

            	default :
            	    break loop5;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return value;
    }
    // $ANTLR end "mord"


    // $ANTLR start "factor"
    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:49:1: factor returns [double value] : ( FLOAT | INT | '(' expr ')' );
    public final double factor() throws RecognitionException {
        double value = 0.0;

        Token FLOAT2=null;
        Token INT3=null;
        double expr4 = 0.0;


        try {
            // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:49:33: ( FLOAT | INT | '(' expr ')' )
            int alt6=3;
            switch ( input.LA(1) ) {
            case FLOAT:
                {
                alt6=1;
                }
                break;
            case INT:
                {
                alt6=2;
                }
                break;
            case 21:
                {
                alt6=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 6, 0, input);

                throw nvae;
            }

            switch (alt6) {
                case 1 :
                    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:49:35: FLOAT
                    {
                    FLOAT2=(Token)match(input,FLOAT,FOLLOW_FLOAT_in_factor498); 
                    value = Double.parseDouble((FLOAT2!=null?FLOAT2.getText():null));

                    }
                    break;
                case 2 :
                    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:50:9: INT
                    {
                    INT3=(Token)match(input,INT,FOLLOW_INT_in_factor510); 
                    value = Integer.parseInt((INT3!=null?INT3.getText():null));

                    }
                    break;
                case 3 :
                    // C:\\Documents and Settings\\Costas Kakousis\\Desktop\\ANTLR_SandBox\\Utility\\utility.g:51:13: '(' expr ')'
                    {
                    match(input,21,FOLLOW_21_in_factor526); 
                    pushFollow(FOLLOW_expr_in_factor528);
                    expr4=expr();

                    state._fsp--;

                    match(input,22,FOLLOW_22_in_factor530); 
                    value = expr4;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return value;
    }
    // $ANTLR end "factor"

    // Delegated rules


 

    public static final BitSet FOLLOW_stat_in_prog113 = new BitSet(new long[]{0x000000000020C002L});
    public static final BitSet FOLLOW_expr_in_stat135 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_term_in_expr159 = new BitSet(new long[]{0x0000000000003F02L});
    public static final BitSet FOLLOW_ternary_in_expr166 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_condition_in_ternary194 = new BitSet(new long[]{0x0000000000080000L});
    public static final BitSet FOLLOW_19_in_ternary197 = new BitSet(new long[]{0x000000000030C000L});
    public static final BitSet FOLLOW_term_in_ternary201 = new BitSet(new long[]{0x0000000000100000L});
    public static final BitSet FOLLOW_20_in_ternary203 = new BitSet(new long[]{0x000000000020C000L});
    public static final BitSet FOLLOW_term_in_ternary207 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_GT_in_condition235 = new BitSet(new long[]{0x000000000020C000L});
    public static final BitSet FOLLOW_term_in_condition239 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_LT_in_condition252 = new BitSet(new long[]{0x000000000020C000L});
    public static final BitSet FOLLOW_term_in_condition256 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_GTE_in_condition269 = new BitSet(new long[]{0x000000000020C000L});
    public static final BitSet FOLLOW_term_in_condition273 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_LTE_in_condition285 = new BitSet(new long[]{0x000000000020C000L});
    public static final BitSet FOLLOW_term_in_condition289 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_EQ_in_condition301 = new BitSet(new long[]{0x000000000020C000L});
    public static final BitSet FOLLOW_term_in_condition305 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_NEQ_in_condition317 = new BitSet(new long[]{0x000000000020C000L});
    public static final BitSet FOLLOW_term_in_condition321 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_mord_in_term351 = new BitSet(new long[]{0x0000000000000032L});
    public static final BitSet FOLLOW_PLUS_in_term356 = new BitSet(new long[]{0x000000000020C030L});
    public static final BitSet FOLLOW_mord_in_term360 = new BitSet(new long[]{0x0000000000000032L});
    public static final BitSet FOLLOW_MINUS_in_term379 = new BitSet(new long[]{0x000000000020C030L});
    public static final BitSet FOLLOW_mord_in_term383 = new BitSet(new long[]{0x0000000000000032L});
    public static final BitSet FOLLOW_factor_in_mord425 = new BitSet(new long[]{0x00000000000000C2L});
    public static final BitSet FOLLOW_MULT_in_mord431 = new BitSet(new long[]{0x000000000020C0C0L});
    public static final BitSet FOLLOW_factor_in_mord435 = new BitSet(new long[]{0x00000000000000C2L});
    public static final BitSet FOLLOW_DIV_in_mord452 = new BitSet(new long[]{0x000000000020C0C0L});
    public static final BitSet FOLLOW_factor_in_mord456 = new BitSet(new long[]{0x00000000000000C2L});
    public static final BitSet FOLLOW_FLOAT_in_factor498 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_INT_in_factor510 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_21_in_factor526 = new BitSet(new long[]{0x000000000060C000L});
    public static final BitSet FOLLOW_expr_in_factor528 = new BitSet(new long[]{0x0000000000400000L});
    public static final BitSet FOLLOW_22_in_factor530 = new BitSet(new long[]{0x0000000000000002L});

}